﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using famails.iface;
using famails.dao;
using famails.App_Code.source.dto;

namespace famails.bus
{
    /// <summary>
    /// Summary description for CM_CustomerCareBUS
    /// </summary>
    public class CM_CustomerCareBUS : ICM_CustomerCare
    {
        CM_CustomerCareDAO cateDao;
        public CM_CustomerCareBUS()
        {
            cateDao = new CM_CustomerCareDAO();
        }

        #region IArticle Members

        public DataTable GetByID(decimal ID, int UserID)
        {
            return cateDao.GetByID(ID, UserID);
        }

        #endregion


        public DataTable Search(string subject, int groupid, string from, string to, int userid)
        {
            return cateDao.Search( subject, groupid, from, to, userid);
        }

        public object Insert(CM_CustomerCareDTO dto)
        {
            return cateDao.Insert(dto);
        }

        public bool Edit(CM_CustomerCareDTO dto)
        {
            return cateDao.Edit(dto);
        }

        public bool Delete(int id)
        {
            return cateDao.Delete(id);
        }

        /// <summary>
        /// Kiem tra da gui mail hay chua
        /// </summary>
        /// <param name="id">Customer Care ID</param>
        /// <returns></returns>
        internal bool CheckBeforDelete(int id)
        {
            throw new NotImplementedException();
        }

        internal void AddSendMailByCustomerCareID(decimal CustomerCareID, int UserID)
        {
            cateDao.AddSendMailByCustomerCareID(CustomerCareID, UserID);
        }

        internal DataTable GetReportByRegisterId(string CustomerCareId)
        {
            return cateDao.GetReportByRegisterId(CustomerCareId);
        }
        internal DataTable GetErrorMailList(decimal id)
        {
            return cateDao.GetErrorMailList(id);
        }
        internal DataTable GetOpenList(string CustomerCareId)
        {
            return cateDao.GetOpenEmailList(CustomerCareId);
        }
    }
}